package com.lamatek.tags.google;

import java.io.Serializable;

import javax.servlet.jsp.tagext.Tag;
import javax.servlet.jsp.tagext.TagSupport;

/**
 * GoogleMapScaleControlTag
 * 
 * This class represents a &lt;googlemaps;scaleControl> tag. Developers should not subclass or override this
 * class or it's methods.
 * 
 * @author Tom Cole
 * @version 0.40
 */
public class GoogleMapScaleControlTag extends TagSupport implements Serializable {

    boolean enable = false;
    /**
     * Overrides doEndTag() from TagSupport. Developers should not override this method.
     */
    public int doEndTag() {
        Tag tag = this;
        while (tag.getParent() != null) {
            if (tag.getParent() instanceof GoogleMapTag) {
                ((GoogleMapTag) tag.getParent()).setScaleControl(this);
                return EVAL_PAGE;
            }
            tag = tag.getParent();
        }
        return EVAL_PAGE;
    }
    /**
     * Denotes whether or not the map will allow the user to pan the map.
     * 
     * @return True if users can pan the map, false if not.
     */
    public boolean isEnable() {
        return enable;
    }
    /**
     * Sets whether or not users should be allowed to pan the map. If set to
     * false, users can only see the section of map currently displayed.
     * 
     * @param enable True to let users pan, false otherwise.
     */
    public void setEnable(boolean enable) {
        this.enable = enable;
    }
}
